package chapter4.annotation;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

@Service("messageRender")
public class OutputMessageRender implements MessageRender {
	@Autowired
	private MessageProvider messageProvider;

	@Override
	public void render() {
		if (messageProvider == null) {
			System.out
					.println("không có messageProvider IS NULL --------------");
		} else {
			System.out.println(messageProvider.getMessage());
		}

	}

	@Override
	public void setMessageProvider(MessageProvider provider) {
		this.messageProvider = provider;
	}

	@Override
	public MessageProvider getMessageProvider() {
		return this.messageProvider;
	}

}
